package com.cszjzx.member.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.cszjzx.member.po.Master;
import com.cszjzx.member.service.MasterService;
import com.cszjzx.member.service.MasterServiceImpl;
import com.cszjzx.member.service.TempleMemberService;
import com.cszjzx.member.service.TempleMemberServiceImpl;
import com.opensymphony.xwork2.ActionSupport;

public class InfoAction extends ActionSupport{
	HttpServletRequest request;
	MasterService masterService;
	TempleMemberService templeMemberService;
	public String show(){
		request = ServletActionContext.getRequest();
		templeMemberService = new TempleMemberServiceImpl();
		masterService = new MasterServiceImpl();
		Master master = (Master)request.getSession().getAttribute("master");
		int audit=0,auditPass=0,auditUnpass=0;
		//此处是关于右边的显示审核信息条数的计算方法
		if(master.isIssuper()){
			audit = templeMemberService.getByCheckcondition(1);
			request.getSession().setAttribute("audit", audit);
		}
		else{
			int masterid = master.getId();
			audit = templeMemberService.getByMasteridAndCheckcondition(masterid, 1);
			auditPass = templeMemberService.getByMasteridAndCheckcondition(masterid, 2);
			auditUnpass = templeMemberService.getByMasteridAndCheckcondition(masterid, 3);
			request.getSession().setAttribute("audit", audit);
			request.getSession().setAttribute("auditPass", auditPass);
			request.getSession().setAttribute("auditUnpass", auditUnpass);
		}
		return "showSuccess";
	}
}
